package com.example.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultData implements Comparable<ResultData> {
    private List<Road> r;
    private LocalDateTime temp;
    private Double cost;
// 实现Comparable接口的compareTo方法，根据temp进行比较和排序
    @Override
    public int compareTo(ResultData other) {
        if (this.temp.isAfter(other.temp)) {
            return 1; // this.temp晚于other.temp，返回正数
        } else if (this.temp.isBefore(other.temp)) {
            return -1; // this.temp早于other.temp，返回负数
        } else {
            return 0; // this.temp与other.temp相等，返回0
        }
    }


}
